/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ComponenteEntidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Marilyn
 */
@Entity
@Table(name = "modelo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Modelo.findAll", query = "SELECT m FROM Modelo m"),
    @NamedQuery(name = "Modelo.findByIdModelo", query = "SELECT m FROM Modelo m WHERE m.idModelo = :idModelo"),
    @NamedQuery(name = "Modelo.findByModModelo", query = "SELECT m FROM Modelo m WHERE m.modModelo = :modModelo"),
    @NamedQuery(name = "Modelo.findByModDescripcion", query = "SELECT m FROM Modelo m WHERE m.modDescripcion = :modDescripcion"),
    @NamedQuery(name = "Modelo.findByModEstado", query = "SELECT m FROM Modelo m WHERE m.modEstado = :modEstado")})
public class Modelo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idModelo")
    private Integer idModelo;
    @Size(max = 150)
    @Column(name = "mod_Modelo")
    private String modModelo;
    @Size(max = 200)
    @Column(name = "mod_Descripcion")
    private String modDescripcion;
    @Column(name = "mod_Estado")
    private Boolean modEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelo", fetch = FetchType.LAZY)
    private List<Bus> busList;

    public Modelo() {
    }

    public Modelo(Integer idModelo) {
        this.idModelo = idModelo;
    }

    public Integer getIdModelo() {
        return idModelo;
    }

    public void setIdModelo(Integer idModelo) {
        this.idModelo = idModelo;
    }

    public String getModModelo() {
        return modModelo;
    }

    public void setModModelo(String modModelo) {
        this.modModelo = modModelo;
    }

    public String getModDescripcion() {
        return modDescripcion;
    }

    public void setModDescripcion(String modDescripcion) {
        this.modDescripcion = modDescripcion;
    }

    public Boolean getModEstado() {
        return modEstado;
    }

    public void setModEstado(Boolean modEstado) {
        this.modEstado = modEstado;
    }

    @XmlTransient
    public List<Bus> getBusList() {
        return busList;
    }

    public void setBusList(List<Bus> busList) {
        this.busList = busList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idModelo != null ? idModelo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modelo)) {
            return false;
        }
        Modelo other = (Modelo) object;
        if ((this.idModelo == null && other.idModelo != null) || (this.idModelo != null && !this.idModelo.equals(other.idModelo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ComponenteEntidad.Modelo[ idModelo=" + idModelo + " ]";
    }
    
}
